<template>
    <div class="box">
       <van-nav-bar
   title="标题"
   left-text="返回"
   left-arrow
   @click-left="onClickLeft"
 />
       <van-form @submit="onSubmit">
   <van-cell-group inset>
     <van-field v-model="names" name="storeName" label="店铺名：" placeholder="请输入店铺名"
       :rules="[{ required: true, message: '请填写店铺名' }]"
     />
     <van-field v-model="address" name="address" label="地址：" placeholder="请输入地址"
       :rules="[{ required: true, message: '请填写地址' }]"
     />
     <div class="timeq">营业时间</div>
     <van-field v-model="time1" name="weekday" label="周一至周五：" placeholder="请输入时间"
       :rules="[{ required: true, message: '请填写时间' }]"
     />
     <van-field v-model="time2" name="saturday" label="周六：" placeholder="请输入时间"
       :rules="[{ required: true, message: '请填写时间' }]"
     />
     <van-field v-model="time3" name="sunday" label="周日：" placeholder="请输入时间"
       :rules="[{ required: true, message: '请填写时间' }]"
     />
   </van-cell-group>
 <!-- 时间选择 -->
 
 
   <div style="margin: 16px;">
     <van-button round block type="primary" native-type="submit">
       提交
     </van-button>
   </div>
 </van-form>
    </div>
 </template>
 
 <script setup>
 
 import { addStore } from '@/api/api'
import { onMounted,ref } from 'vue';


 const onClickLeft = () => history.back();
     const names= ref('');
     const address = ref('');
     const time1 = ref('');
     const time2 = ref('');
     const time3 = ref('');
     const onSubmit = (values) => {
        addStore(values).then(res=>{
            console.log(res);
        })
    //    console.log( values);
     };
   
 </script>
 
 <style lang="scss" scoped>
 .timeq{
    width: 60px;
    height: 25px;
    font-size: 14px;
    color: blue;
    margin: 5px 10px;
 }
 .box{
    position: relative;
 }
 .van-form{
    margin-left: 20px;
    position: absolute;
    top: 100px;
 }
 
 
 </style>